package com.simoniu.hbase.phoenixmybatis.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.simoniu.hbase.phoenixmybatis.entity.Students;
import com.simoniu.hbase.phoenixmybatis.mapper.StudentsMapper;
import com.simoniu.hbase.phoenixmybatis.service.StudentsService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

@Service
public class StudentsServiceImpl implements StudentsService {
    @Resource
    private StudentsMapper studentsMapper;
    @Override
    public List<Students> selectAll() {
        return studentsMapper.selects();
    }
    @Override
    public IPage<Students> page(Integer page, Integer size) {
        IPage<Students> ipage = new Page<>(page, size);
        return studentsMapper.page(ipage);
    }
    @Override
    public boolean saveStudent(Students s) {
        try {
            studentsMapper.upsert(s);
            return true;
        } catch (Exception ex) {
            ex.printStackTrace();
            return false;
        }
    }
}
